Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Negation types #29

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

RFC: Negation types #29

wants to merge 7 commits into from

Conversation

alexmccord
Copy link
Contributor

docs/negation-types.md Outdated Show resolved Hide resolved
docs/negation-types.md Outdated Show resolved Hide resolved
docs/negation-types.md Outdated Show resolved Hide resolved
Comment on lines +72 to +74
We can use type families to have this guarantee. Add a `negate<T>` type family which would be internal to the type inference engine, and have the syntax `~T` produce that type family, not a `NegationType`.

As for the type error, we can just consider `negate<{ p: P }>` to be an uninhabited type family, and resolve that as an error type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is very sensible, and aligned with where future proposals will go too (e.g. type indexing syntax like SomeTableType.SomeProperty will probably want to resolve to index<SomeTableType, SomeProperty>). Seems like the right call to me.

@alexmccord alexmccord marked this pull request as ready for review July 18, 2024 15:54
docs/negation-types.md Outdated Show resolved Hide resolved
Co-authored-by: Alexander McCord <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants